@extends('layout')
@section('title', 'Get UID from page post')

@section('content')
      <div class="row">

        <div class="col-md-12">

          <div class="portlet">

            <div class="portlet-header">

              <h3>
                <i class="fa fa-table"></i>
                Get UID from page post
                <a href="javascript:void(0)" id="uid_help" title="Help"><i class="fa fa-question-circle"></i></a>
              </h3>

            </div> <!-- /.portlet-header -->

            <div class="portlet-content">           

              <div class="table-responsive">
               @if(!is_array($feeds))
				<div class="alert alert-danger">
		        <a class="close" data-dismiss="alert" href="#" aria-hidden="true">×</a>
		        {{$feeds}}
		        <?php $feeds = null; ?>
		      </div>
               @endif
               <div class="row">

                <div class="col-md-5">
                 <div class="well">
          				<form id="validate-basic" data-validate="parsley" class="form parsley-form form-inline" method="get" action="">
                        
                        <div class="input-group">
                          <input placeholder="Enter fan page URL" type="text" id="pageurl" value="<?php if(!empty($_GET['pageurl'])) echo $_GET['pageurl']; ?>" name="pageurl" class="form-control parsley-validated" data-required="true">
                					<span class="input-group-btn">
                            <button type="submit" class="btn btn-primary">Get posts <i class="fa fa-rss"></i></button>
                          </span>
                        </div>
              				
                  </form>
                  </div>
                </div>
                  <div class="col-md-7">
                        <div class="row 10pxright">
                            <div class="btn-group btn-get-ids btn-group-lg" role="group" aria-label="...">
                            <button class="btn btn-info" id="getliker" type="button">GET LIKERS <span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span></button>
                            <button class="btn btn-info" id="getcommenter" type="button">GET COMMENTERS <span class="glyphicon glyphicon-comment" aria-hidden="true"></span></button>
                            </div>
                        </div>
                  </div>
              </div>

              <form action="{{ URL::to('fb-audience/get-uid-by-post') }}" method="get" id="frmpostids">
              <input type="hidden" id="ids">

              <table 
                class="table table-striped table-bordered table-hover table-highlight table-checkable" 
                data-provide="datatable" 
                data-display-rows="10"
                data-info="true"
                data-search="true"
                data-length-change="true"
                data-paginate="true"
              >
                  <thead>
                    <tr>
                      <th class="checkbox-column">
                        <input type="checkbox" class="icheck-input">
                      </th>
                      <th data-direction="asc" data-filterable="false" data-sortable="true">Content</th>
                      <th data-filterable="false" data-sortable="true">Like</th>
                      <th data-filterable="false" data-sortable="true">Comment</th>
                      <th data-filterable="false" data-sortable="true">Share</th>
                      <th data-filterable="false" data-sortable="true" width="120">Created on</th>
                    </tr>
                  </thead>
                  <tbody>
					@if( !empty($feeds))
					@foreach( $feeds as $feed)
					<?php if(empty($feed)) continue; ?>
                    <tr>
                      <td class="checkbox-column">
                        <input type="checkbox" class="icheck-input item-post-id" name="post-id[]" data-total-share="<?php if(!empty($feed['shares']['count'])) echo ($feed['shares']['count']); ?>" data-total-cmt="<?php if(!empty($feed['comments']['summary']['total_count'])) echo ($feed['comments']['summary']['total_count']); ?>" data-total-like="<?php if(!empty($feed['likes']['summary']['total_count'])) echo ($feed['likes']['summary']['total_count']); ?>" value="{{ $feed['id'] }}">
                      </td>
                      <td class="feed-msg"><?php if(!empty($feed['type'])) echo Pagepost::showFbPostTypeIcon($feed['type']); ?> <span class="fbmsg" data-id="{{ $feed['id'] }}"><?php if(!empty($feed['message'])) echo nl2br($feed['message']); ?></span> <a href="<?php echo $link = isset($feed['link']) ? $feed['link'] : 'https://facebook.com/' . $feed['id']; ?>" target="_blank">{{ Pagepost::showFbPostTypeIcon('new-window') }}</a></td>
                      <td align="center"><?php if(!empty($feed['likes']['summary']['total_count'])) echo ($feed['likes']['summary']['total_count']); ?></td>
                      <td align="center"><?php if(!empty($feed['comments']['summary']['total_count'])) echo ($feed['comments']['summary']['total_count']); ?></td>
                      <td align="center"><?php if(!empty($feed['shares']['count'])) echo ($feed['shares']['count']); ?></td>
                      <td align="center"><small><?php if(!empty($feed['created_time'])) echo date('Y-m-d', strtotime($feed['created_time'])); ?></small></td>
                    </tr>
					@endforeach
					@endif
                  </tbody>
                </table>
                </form>
              </div> <!-- /.table-responsive -->
              

            </div> <!-- /.portlet-content -->

          </div> <!-- /.portlet -->

        

        </div> <!-- /.col -->

      </div> <!-- /.row -->
@stop

@section('footer')
<script src="{{ URL::to('assets/js/plugins/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ URL::to('assets/js/plugins/datatables/DT_bootstrap.js') }}"></script>
<script src="{{ URL::to('assets/js/plugins/tableCheckable/jquery.tableCheckable.js') }}"></script>
<script src="{{ URL::to('assets/js/FileSaver.min.js') }}"></script>


<div id="basicModal" class="modal fade" data-keyboard="false" data-backdrop="static">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h3 class="modal-title"></h3>
      </div>
      <div class="modal-body">
        
      </div>
      <div class="modal-footer">
        <div style="float: left">
          <!-- Single button -->
        <div class="btn-group">
          <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
            <span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span> Save as.. <span class="caret"></span>
          </button>
          <ul class="dropdown-menu" role="menu">
            <li><a href="javascript:void(0)" id="saveraw">Raw text (.txt)</a></li>
          </ul>
        </div>
        </div>
        <div class="btn-group" role="group" aria-label="...">
          <button type="button" id="btnpause" class="btn btn-default"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> Pause</button>
          <button type="button" id="btnstop" class="btn btn-default"><span class="glyphicon glyphicon-stop" aria-hidden="true"></span> Stop</button>
        </div>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="blankModal" class="modal fade" data-keyboard="false" data-backdrop="static">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h3 class="modal-title"></h3>
      </div>
      <div class="modal-body">
        
      </div>
      <div class="modal-footer">
          <button type="button" data-dismiss="modal" class="btn btn-default"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Close</button>
        </div>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
@stop